<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="/js/axios.js"></script>
</head>

<body>
    <button id="btn">发起get</button>
    <button id="btn1">发起post</button>
    <script>
        document.querySelector('#btn').addEventListener('click', function () {
            var url = 'http://www.liulongbin.top:3006/api/get'
            var paramsobj = { name: 'pink', age: 20 }
            axios.get(url, { params: paramsobj }).then(function (res) {
                console.log(res);
                var result = res.data
                console.log(result);
            })


        })
        document.querySelector('#btn1').addEventListener('click', function () {
            var url = 'http://www.liulongbin.top:3006/api/post'
            var paramsobj = { name: 'pink', age: 20 }
            axios.post(url,paramsobj).then(function (res) {
                console.log(res);
                var result = res.data
                console.log(result);
            })


        })
    </script>
</body>

</html>